projects
/
cargo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
81ecf8b
)
Don't allocate in PackageId::hash
author
Alex Crichton
<alex@alexcrichton.com>
Fri, 29 May 2015 21:19:39 +0000
(14:19 -0700)
committer
Alex Crichton
<alex@alexcrichton.com>
Wed, 3 Jun 2015 01:05:47 +0000
(18:05 -0700)
This hash function is called an enormous number of times in `cargo_rustc`, so
optimizing it is fairly important, and it's also quite trivial to not allocate a
string at all (`semver::Version::hash` already does everything we need).
src/cargo/core/package_id.rs
patch
|
blob
|
history
diff --git
a/src/cargo/core/package_id.rs
b/src/cargo/core/package_id.rs
index 992e06b9e4073dc2a9075f1afb6893fa92dbb49a..f585a0137c9e4da8f51191eb4abb98ae076e7c25 100644
(file)
--- a/
src/cargo/core/package_id.rs
+++ b/
src/cargo/core/package_id.rs
@@
-59,7
+59,7
@@
impl Decodable for PackageId {
impl Hash for PackageId {
fn hash<S: hash::Hasher>(&self, state: &mut S) {
self.inner.name.hash(state);
- self.inner.version.
to_string().
hash(state);
+ self.inner.version.hash(state);
self.inner.source_id.hash(state);
}
}